<?php
/**
 * 注：此模板为自动生成模板，需要根据实际情况调整修改
 * 此模板对 无主键/单一主键 表的支持较好，联合主键表在下一版本开发
 */
namespace Data;

use Utils\MyException;

class Restaurant_settings_sound {

    //数组
    private $array;


    public function __construct ($array){

        $this->array = $array;

        self::setDefault();

    }

    public function getArray() {
        return $this->array;
    }

    public function updateWithArray($array) {
        foreach($array as $key=>$value)
        {
            if(array_key_exists($key,$this->array))
            {
                $this->array = array_merge($this->array,array($key=>$value));
            }
        }
    }



    private function setDefault(){

        if(count($this->array)==0){
            self::setRESTAURANT_ID("null");
            self::setIS_RING("0");
            self::setIS_VIBRATION("0");

        }
    }






    public function setRESTAURANT_ID($value) {
        $this->array = array_merge ($this->array,array(
            'RESTAURANT_ID' => $value));
    }
    public function getRESTAURANT_ID(){

        return $this->array ['RESTAURANT_ID'];
    }


    public function setIS_RING($value) {
        $this->array = array_merge ($this->array,array(
            'IS_RING' => $value));
    }
    public function getIS_RING(){

        return $this->array ['IS_RING'];
    }


    public function setIS_VIBRATION($value) {
        $this->array = array_merge ($this->array,array(
            'IS_VIBRATION' => $value));
    }
    public function getIS_VIBRATION(){

        return $this->array ['IS_VIBRATION'];
    }


    public function toInsertCSV() {
        $str="";

        // RESTAURANT_ID
        $str .= self::getRESTAURANT_ID().",";
        // IS_RING
        $str .= "'". self::getIS_RING()."',";
        // IS_VIBRATION
        $str .= "'". self::getIS_VIBRATION()."'";
        return $str;
    }



    public function toUpdateSet() {
        $str="";

        // IS_RING
        $str.= '`IS_RING` = "' . self::getIS_RING() . '",';

        // IS_VIBRATION
        $str.= '`IS_VIBRATION` = "' . self::getIS_VIBRATION(). '"';
        return $str;
    }



    public function toUpdateWhere(){
        $str = "";
        $str .= "`RESTAURANT_ID` = '" . self::getRESTAURANT_ID()."'";
        return $str;
    }

}

